<template>
    <div>
        <el-select clearable v-model="localSelect" placeholder="请选择" style="width: 150px;">
            <el-option v-for="item in routeOptions" :key="item.routeid" :label="item.name" :value="item.routeid" />
        </el-select>
    </div>
</template>

<script setup>
import { routeList } from "@/api/cleanRoute"
const props = defineProps({
    selectValue: {
        type: String,
        value: ""
    }
})
const emit = defineEmits(['update:selectValue'])
const localSelect = computed({
    get() {
        return props.selectValue
    },
    set(value) {
        emit('update:selectValue', value)
    }
})

const routeOptions = ref([])
function getRouteList() {
    routeList().then(res => {
        if (res.code == 200) {
            routeOptions.value = res.data
        }
    })
}
onMounted(() => {
    getRouteList()
})
</script>

<style lang="scss" scoped></style>